import {createSlice} from "@reduxjs/toolkit";
const goodsSlice = createSlice({
    name: 'goods',
    initialState: {
        goodsList: []
    },
    reducers: {
        addGoods(state, { payload }) {
            state.goodsList.unshift({
                id: Math.random().toString(36).slice(2),
                ...payload
            })
        }
    }
})
const {addGoods} = goodsSlice.actions
export {goodsSlice, addGoods}
